<template>
  <div>

    <div v-loading="dataLoading">
      <change-info :change-data="changeInfo" :detail-data="detailData" />
      <base-info style="margin-top:20px" :detail-data="detailData" />
    </div>
  </div>
</template>
<script>
import { getDetailByApplyCode, getDetailById } from '@/api/shopChangeRule'

import changeInfo from './component/rebateRuleChangeInfo.vue'
import baseInfo from '../component/rebateBaseInfo.vue'
export default {
  name: 'RebateChangeDetail',
  components: { baseInfo, changeInfo },
  props: {
  },
  data() {
    return {
      id: '',
      applyCode: '',
      dataLoading: false,
      detailData: {},
      changeInfo: {}
    }
  },
  created() {
    this.id = this.$route.query.id
    this.applyCode = this.$route.query.applyCode
    if (this.applyCode) {
      this.dataLoading = true
      getDetailByApplyCode(this.applyCode).then(res => {
        if (res.success === 1) {
          this.detailData = res.data
          this.dataLoading = false
        }
      }).catch(() => {
        this.dataLoading = false
      })
    }
    if (this.id) {
      getDetailById(this.id).then(res => {
        if (res.success === 1) {
          this.changeInfo = res.data
        }
      })
    }
  },
  methods: {}
}
</script>
<style lang="scss" scoped>
/deep/ .el-breadcrumb__inner{
    color: $qup-color-primary;
  }
</style>
